Functions

Published on: Sun Mar 07 2010

A function is a small block of code that can be called from another point in the program.  Functions create structure, and structure creates understanding Main() function delegates. Calling Function sends work out to called function Logical delinking – Which functions your code does not have to follow one step at a time. It can jump around. Loops and Functions Arguments are pieces of data that are passed into functions. Call by Value: Changes to argument are not sent back to calling function. A Function gives back return values (usually) To return a value: return value; The returned value must match the return type in the function header
float sqrt(x) {        return value_float; }
 If not returning the header needs nothing
void function() { }
 A function may have several return statements, but it will only return one at a time.